$(".btn-revoke").on("click", function (e) {
    var username = $(this).data("username");
    var token = $(this).data("token");
    var url = $(this).data("url");
    console.log(url);
    bootbox.confirm({
        message: "Do you confirm to revoke this token?",
        buttons: {
            confirm: {
                label: 'Yes',
                className: 'btn-success'
            },
            cancel: {
                label: 'No',
                className: 'btn-danger'
            }
        },
        callback: function (result) {
            console.log('This was logged in the callback: ' + result);
            if(result){
                $.ajax({
                    method: "DELETE",
                    url: url+"/"+username+"/"+token,
                    success: function(msg){
                        console.log( "Data Deleted: " + msg );
                        location.href = url+"?revoke-"+msg;
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });
            }
        }
    });

})